
const url = 'https://www.imooc.com/api/http/search/suggest?words=js';

const xhr = new XMLHttpRequest();

xhr.onreadystatechange = ()=>{
    if(xhr.readyState != 4) return;
    if((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304){
        console.log(xhr.responseText);
    }
};

xhr.open('GET','./data.json',true);
xhr.send();